package com.wanghai.carwashing.api.controller;

import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.ModelAttribute;

/**
 *
 * @author ����
 */
public class BaseController {
  
    protected HttpSession session;
    
    protected HttpServletRequest request;
    
    protected HttpServletResponse response;
   
    @ModelAttribute
    public void init(HttpSession session,HttpServletRequest request,HttpServletResponse response){
        try {
            this.request = request;
            this.session = session;
            this.response = response;
            request.setCharacterEncoding("UTF-8");
            response.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(BaseController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
